package com.lightheart.sphr.xiaobinggan.design

import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import com.lightheart.sphr.xiaobinggan.R
import com.lightheart.sphr.xiaobinggan.base.BaseActivity
import com.lightheart.sphr.xiaobinggan.design.adapter.Adapter_Diary
import com.lightheart.sphr.xiaobinggan.module.home.presenter.HomePresenter
import java.util.*

/***
 * https://blog.csdn.net/qq_37717853/article/details/87893523?utm_medium=distribute.pc_relevant.none-task-blog-title-10&spm=1001.2101.3001.4242
 */

class RvAppBarActivity : BaseActivity<HomePresenter>() {

    private var mRecyclerView: RecyclerView? = null


    override fun getLayoutId() = R.layout.activity_rv_app_bar

    override fun initInjector() {
    }

    override fun initView() {
        val layoutManager: RecyclerView.LayoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
        mRecyclerView = findViewById(R.id.rv)
        mRecyclerView?.layoutManager = layoutManager
        initList()
    }

    private fun initList() {
        val dataList = ArrayList<String>()
        for (i in 0..19) {
            dataList.add("日记$i")
        }
        val mAdapter = Adapter_Diary(dataList)
        mRecyclerView?.adapter = mAdapter
    }
}